<template>
  <div>
    <!-- 输入框 -->
    <header class="header">
      <h1>小黑记事本</h1>
      <input placeholder="请输入任务" class="new-todo" v-model="inputVal" />
      <!-- <button class="add" @click="$emit('addList', inputVal)">添加任务</button> -->
      <button class="add" @click="post">添加任务</button>

    </header>
  </div>
</template>

<script>
export default {
  data() {
    return {
      inputVal: "",
    };
  },
  methods: {
    post() {
      this.$emit('addList', this.inputVal);
      this.inputVal = "";
    },
  }
};
</script>

<style lang="sass" scoped></style>
